﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _1_2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        

        Label[] lbZLSS = new Label[] { this.SS1, this.SS2, this.SS3, this.SS4, this.SS5, this.SS6, this.SS7 };
        Label[] lbWRLB = new Label[] { this.LB1, this.LB2, this.LB3, this.LB4, this.LB5, this.LB6, this.LB7 };
        Label[] lbCLFF = new Label[] { this.FF1, this.FF2, this.FF3, this.FF4, this.FF5, this.FF6, this.FF7 };
        Label[] lbSJCLNL = new Label[] { this.NL1, this.NL2, this.NL3, this.NL4, this.NL5, this.NL6, this.NL7 };
        Label[] lbCLL = new Label[] { this.CLL1, this.CLL2, this.CLL3, this.CLL4, this.CLL5, this.CLL6, this.CLL7 };
        Label[] lbPFK = new Label[] { this.PFK1, this.PFK2, this.PFK3, this.PFK4, this.PFK5, this.PFK6, this.PFK7 };
        Label[] lbYXTS = new Label[] { this.TS1, this.TS2, this.TS3, this.TS4, this.TS5, this.TS6, this.TS7 };
        Label[] lbYXFY = new Label[] { this.FY1, this.FY2, this.FY3, this.FY4, this.FY5, this.FY6, this.FY7 };
        Label[] lbTRSYRQ = new Label[] { this.RQ1, this.RQ2, this.RQ3, this.RQ4, this.RQ5, this.RQ6, this.RQ7 };

        using (DataClassesDataContext mydata = new DataClassesDataContext())
        {
            
            var rd = from a in mydata.A01102
                     join w in mydata.wrlb on a.P_TYPE equals Convert.ToInt32( w.p_type)
                     join c in mydata.CODE_CLEAN on a.METHOD_CODE equals c.SF_CODE
                     join f in mydata.F_OUTPUT on a.SERIAL equals f.SERIAL
                     where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                     where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                     select new
                     {
                        zlss=a.FACILITY_NAME,
                        wrlx=w.P_name,
                        clff=c.SF_NAME,
                        sjclnl=a.PLAN_COUNT,
                        cll=a.DEAL_CNT,
                        pfk=f.OUT_NAME + f.OUTPUT_CODE,
                        yxts=a.USE_DAYS,
                        yxfy=a.USE_FEE,
                        trsyrq = a.FOUND_DATE
                     };
            int i = 0;
            foreach (var r in rd)
            {
                lbZLSS[i].Text = r.zlss;
                lbWRLB[i].Text = r.wrlx;
                lbCLFF[i].Text = r.clff;
                lbSJCLNL[i].Text = r.sjclnl == null ? "" : string.Format("{0:#.####}", r.sjclnl);
                lbCLL[i].Text = r.cll == null ? "" : string.Format("{0:#.####}", r.cll);
                lbPFK[i].Text = r.pfk;
                lbYXTS[i].Text = r.yxts == null ? "" : Convert.ToString(r.yxts);
                lbYXFY[i].Text = r.yxfy == null ? "" : string.Format("{0:#.####}", r.yxfy);
                lbTRSYRQ[i].Text = r.trsyrq == null ? "" : string.Format("{0:yyyy-mm-dd}", r.trsyrq);
                i++;
                if (i >= 7) break;
            }
        }
    }
}